package com.culturalCenter.dataCenter.mapper.user;

import com.culturalCenter.dataCenter.entity.user.UserActivitySignUpType;
import com.culturalCenter.dataCenter.mapper.base.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserActivitySignUpTypeMapper extends BaseMapper<UserActivitySignUpType> {

    /**
     * 通过用户id查询
     */
    List<UserActivitySignUpType> queryByUserId(@Param("userId") String userId);

    /**
     * 通过用户id和参与类型查询
     *
     * @param userId
     * @param isVolunteer
     *
     * @return
     */
    @Select("SELECT * FROM cdc_user_activity_signUpType WHERE userId=#{userId} AND isVolunteer = #{isVolunteer}")
    List<UserActivitySignUpType> queryByUserIdAndType(@Param("userId") String userId, @Param("isVolunteer") int isVolunteer);

    /**
     * 批量插入数据
     *
     * @param userActivitySignUpTypeList
     */
    void insertBatch(List<UserActivitySignUpType> userActivitySignUpTypeList);

    /**
     * 清空表数据
     */
    @Delete("TRUNCATE cdc_user_activity_signUpType")
    void deleteAll();

}
